package rasterprimate;

import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.engine.schedule.ScheduledMethod;
import repast.simphony.parameter.Parameters;

import com.vividsolutions.jts.geom.Coordinate;

//this represents a memory held by an individual primate
public class FoodSourceMem {

	Coordinate coord;
	double maxFood;
	double regrowRate;
	double foodRemembered;
	double foodCapacity;
	int[] gridLoc = new int[2];
	Resource resource;
	
	
	public FoodSourceMem(Resource res){
		
		//get/set parameters
		regrowRate = Constants.regrowth;
		resource = res;
		coord = res.getCoord();
		maxFood=res.getmaxResLevel();
		foodCapacity = res.getmaxResLevel();
		foodRemembered = res.getresLevel();
		gridLoc[0]=res.gridX;
		gridLoc[1]=res.gridY;
		
	}
	
	public void step(){
		//food remembered will grow back at the same rate as the "regrowRate"
			if (foodRemembered + regrowRate< maxFood){
				foodRemembered = foodRemembered + regrowRate;
		}else{
			foodRemembered = maxFood;
		}
			
	}
	
	public void setFoodRemembered(double f){
		foodRemembered=f;
	}
	public double getFoodRemembered(){
		return foodRemembered;
	}
	public Coordinate getCoord(){
		return coord;
	}
	public void setMaxFood(double m){
		maxFood = m;
	}
	public int getGridX(){
		return gridLoc[0];
	}
	public int getGridY(){
		return gridLoc[1];
	}
	public Resource getResource(){
		return resource;
	}
	public double getFoodCapacity(){
		return foodCapacity;
	}
	public void setFoodCapacity(double c){
		foodCapacity = c;
	}
}
